home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / ArtForTheMac.sea.hqx / Art Document Text < prev    next >
Text File  |  1992-09-20  |  44KB  |  1,176 lines

  1. The following is extracted from the original art manual page.
  2.  
  3.  
  4. DESCRIPTION
  5.      Art renders the scene defined in a  scene description file,
  6.      producing encoded 24 bit raster files as output.
  7.  
  8.  
  9.      C style comments are supported
  10.      and the remainder of a line can be made into a comment by  a
  11.      #  symbol.  This version attempts to speed up ray tracing by
  12.      using shadow caches, and a kd-tree to do non-uniform spatial
  13.      subdivision.
  14.  
  15.  
  16. COMMANDS
  17.   Including files and variables.
  18.      include filename
  19.           Includes the file filename in the current file. If  the
  20.           extension on filename is .frameid the frameid extension
  21.           is replaced with whatever the frameid is for the  image
  22.           (the  default  is  000,  so bloot.frameid will make art
  23.           look for a file called bloot.000 is  nothing  has  been
  24.           specified on the command line).
  25.  
  26.      varname=expr assigns the  expression  expr  to  varname.  An
  27.           expression  can  be any mixture of floats, integers, or
  28.           character constants of the form  'x'  where  x  is  the
  29.           character. The variables x, y, and, z are predefined as
  30.           the character values 'x', 'y', and  'z',  for  backward
  31.           compatability.  The  frame  number for the frame can be
  32.           accessed via the variable frameno.  Note: the value  in
  33.           frameno  will  only  be  meaningful if the -f option is
  34.           passed an integer.
  35.  
  36.   Setting options.
  37.      output type
  38.           sets the output format for an image.
  39.                     e.g. output rle
  40.  
  41.           makes the output image run-length encoded (the default)
  42.           without  saving alpha information. Other output formats
  43.           are rgb, rgba, and rlea.   Formats  ending  in  an  'a'
  44.           include alpha information in the output file.
  45.  
  46.      twentyfivebit on|off
  47.           Starts the ray tracer generating 25 bit rgb values. The
  48.           default is off, as it's only for when you need that bit
  49.           extra.
  50.  
  51.      maxtreedepth depth
  52.           sets the maximum depth for the kd-tree to split to.
  53.  
  54.                     e.g. maxtreedepth 35
  55.  
  56.           sets the maxtreedepth to 35 (the default).
  57.  
  58.      maxhitlevel depth
  59.           sets the maximum number of rays traced for reflection.
  60.  
  61.                     e.g. maxhitlevel 6
  62.  
  63.           sets the maxhitlevel to 6 (the default).
  64.  
  65.      pixelgrid on
  66.           sample the image one pixel wider and hider and generate
  67.           the  picture  from averaging the resulting grid of pix-
  68.           els. This happens by default if the number of  raysper-
  69.           pixel is greater than one. Without this option what you
  70.           see is what you hit.
  71.  
  72.      raysperpixel
  73.           set the number of rays per pixel.
  74.  
  75.                     e.g. raysperpixel 4
  76.  
  77.           this value should be an integer number, default is one.
  78.           If  the  number of raysperpixel is greater than one the
  79.           pixelgrid is turned on  automatically,  and  the  final
  80.           pixel  value  is the average of the grid plus any extra
  81.           rays.  Generally 4 rays  per  pixel  will  remove  most
  82.           signs  of aliasing, with 16 giving a good approximation
  83.           to "perfection" (if you have the time!).
  84.  
  85.      antialiasing
  86.           this keyword can be followed by the  flag  adaptive  or
  87.           brute.  If the brute keyword is used the raytracer will
  88.           always trace as many rays per pixel as  given,  if  the
  89.           adaptive keyword is used the raytracer will trace up to
  90.           the number of rays given, but attempts to minimise  the
  91.           number  of rays by checking the local variation where a
  92.           ray is being traced.
  93.  
  94.      background
  95.           sets the background colour.
  96.  
  97.                     e.g. background 0.0, 1.0, 0.0
  98.  
  99.           sets the background colour to green.
  100.  
  101.      falloff
  102.           specifies the fall off in  the  medium.  The  resulting
  103.           intensity for an initial intensity i distance d away is
  104.           calculated according to i / (1.0 + falloff * d).
  105.  
  106.                     e.g. falloff 0.0
  107.  
  108.           sets the falloff to zero (the default).
  109.  
  110.      ri
  111.           sets the world refractive index.
  112.  
  113.                     e.g. ri 1.0
  114.  
  115.           sets the refractive index to 1.0 (the default).
  116.  
  117.      fogfactor
  118.           specifies a fogfactor. Unless this  value  is  non-zero
  119.           the  hazecolour  and  rfactor are ignored. Objects that
  120.           are more distant will have the hazecolor  blended  with
  121.           them  according to the following equation (derived from
  122.           Beer's Law):
  123.  
  124.                I(d) = I(base) * (1 - (1 - rfactor) * exp(fogfactor * d))
  125.  
  126.           A value of 0.00001 would give a slight amount of  haze,
  127.           while a value of 0.004 gives a very misty picture.
  128.  
  129.                     e.g fogfactor 0.0005
  130.  
  131.           sets the fogfactor to 0.0005 (the default is 0).
  132.  
  133.      hazecolour
  134.           specifies a hazecolour to be blended with more  distant
  135.           objects.
  136.  
  137.                     eg. hazecolour 0.5, 0.5, 1.0
  138.  
  139.           sets the haze color to a bluish grey.  The  default  is
  140.           white.
  141.  
  142.      rfactor
  143.           specifies an rfactor for use below in  computing  haze.
  144.           The  rfactor  is  a measure of the fraction of incident
  145.           radiation that objects reflect in the atmosphere.
  146.  
  147.                     e.g. rfactor 0.3
  148.  
  149.           sets the rfactor to 0.3 (the default).
  150.  
  151.      projection
  152.           sets the projection type, either orthographic  or  per-
  153.           spective.  The  default  is  perspective.  If an ortho-
  154.           graphic projection is  chosen  the  screensize  keyword
  155.           should  be used to set the height and width of clipping
  156.           window.
  157.  
  158.      lookat
  159.           sets the viewpoint and direction by giving a  reference
  160.           point  for  the center of the image. A twist around the
  161.           line of sight may also be specified. Note:  if  the  up
  162.           vector  is  to  be  changed  up  should  be used before
  163.           lookat.
  164.  
  165.                     e.g. lookat(10.0, 10.0, 10.0, 0.0, 0.0, 0.0, 45.0)
  166.  
  167.           puts the eyepoint at (10, 10, 10) looking at the origin
  168.           with a 45 degree twist around the line of sight.
  169.  
  170.      up
  171.           sets the world  up  to  be  something  other  than  the
  172.           default (positive y).
  173.  
  174.                     e.g. up(0.0, 0.0, 1.0)
  175.  
  176.           specifies that the world up is positive z.  Note:  this
  177.           must be used before lookat.
  178.  
  179.      screensize
  180.           specifies the size of the  screen  the  rays  originate
  181.           from
  182.  
  183.                      e.g. screensize 2.0, 2.0
  184.  
  185.           sets it to a sqare 2.0 by 2.0  screen  units,  centered
  186.           around the origin (the default).
  187.  
  188.      fieldofview
  189.           specifies the field of view.
  190.  
  191.                     e.g. fieldofview 90.0
  192.  
  193.           sets it to 90 degrees (the default). Reducing the field
  194.           of view zooms on the center of the image.
  195.  
  196.      title
  197.           is used to specify a title to be  saved  in  the  image
  198.           file. Quotes are required.
  199.  
  200.                     e.g. title "Man's inhumanity to man"
  201.  
  202.           provides a good name for any previously untitled work.
  203.  
  204.      sourceradius
  205.           (followed by a  number)  specifies  an  average  source
  206.           radius  distribution  for  use with the ripples texture
  207.           decribed below.
  208.  
  209.                e.g. sourceradius 100
  210.  
  211.           specifies that the average radius of the centers of the
  212.           randomly placed wave sources is 100 unit.
  213.  
  214.   Specifying light sources.
  215.      Lights are treated  essentially  like  objects  and  may  be
  216.      included  in  composite objects (such as lamps) so that they
  217.      move with the object.
  218.  
  219.      light
  220.           is used to define a light source. A point light  source
  221.           is defined by two attributes: colour and location.
  222.  
  223.                e.g. light {
  224.                          colour 1.0, 1.0, 1.0
  225.                          location (-10.0, 40.0, 20.0)
  226.                     }
  227.  
  228.           defines a white light source of unit intensity  at  the
  229.           point  (-10,  40,  20).  Lights  are  treated  as point
  230.           sources unless a radius is specified using  the  radius
  231.           keyword.  The  keyword numrays (followed by an integer)
  232.           determines the number of rays used to sample  the  area
  233.           light.  Non-point lightsources generally lead to softer
  234.           shadows.  Lights may also be given a direction  and  an
  235.           angle.
  236.  
  237.                e.g. light {
  238.                          colour 1.0, 1.0, 1.0
  239.                          direction (10.0, -40.0, -20.0)
  240.                          angle 20.0
  241.                          location (-10.0, 40.0, 20.0)
  242.                     }
  243.  
  244.           defines a light source with light going in  the  direc-
  245.           tion  of the origin and a spread of 20 degrees from its
  246.           location around its direction vector.  If  the  keyword
  247.           insideangle  is  used  then  the intensity of the light
  248.           will fall of linearly to zero from the inside angle  to
  249.           the  angle  of  the directional light. A slight falloff
  250.           can be introduced inside the inside angle by using  the
  251.           beamdistribution  keyword. This uses the usual beamdis-
  252.           tribution function, that is  raising  the  cos  of  the
  253.           angle  between  the center of the directional light and
  254.           the point of interest raised to the beam  distribution.
  255.           For example:
  256.  
  257.                e.g. light {
  258.                          colour 1.0, 1.0, 1.0
  259.                          direction (10.0, -40.0, -20.0)
  260.                          angle 20.0
  261.                          insideangle 20.0
  262.                          beamdistribution 15.0
  263.                          location (-10.0, 40.0, 20.0)
  264.                     }
  265.  
  266.           If no angle is specified the light  is  assumed  to  be
  267.           distant  (like sunlight) and to have the same direction
  268.           everywhere in the scene. If the light source contains
  269.                shadows off
  270.           then shadow testing is turned off for that light.
  271.  
  272.   Setting Object Attributes.
  273.      Attributes are maintained on an attribute stack.  If  attri-
  274.      butes  are  not  set  in the object it will use whatever has
  275.      been defined outside the object's scope.
  276.  
  277.      ambient
  278.           specifies the amount  of  ambient  light  affecting  an
  279.           object
  280.  
  281.                     e.g. ambient 0.1, 0.1, 0.1
  282.  
  283.           Specifies ambient light with colour values r = 0.1,
  284.           g = 0.1, and b = 0.1.
  285.  
  286.      material
  287.           sets the material properties for the object
  288.  
  289.                     e.g. material 0.0, 1.0, 0.0, 0
  290.  
  291.           The numbers in the material are as follows: the refrac-
  292.           tive  index,  the  diffuse component, the specular com-
  293.           ponent, and the specular  exponent.  The  diffuse  com-
  294.           ponent  represents the percentage of light that will be
  295.           reflected diffusely by the object,  the  specular  com-
  296.           ponent  the amount of light that will be reflected in a
  297.           specular  fashion.  The  specular  exponent  (which  is
  298.           always  truncated  down  to the nearest integer) deter-
  299.           mines how  rough  the  surface  is  (on  a  microscopic
  300.           level),  so  the  larger this value becomes the smaller
  301.           the specular highlights on the object. As  a  rule  the
  302.           specular component and diffuse components should add up
  303.           to one, and if reflections are being allowed most real-
  304.           istic  results  for  a non-transparent objects material
  305.           occur when the level of reflectance is the same as  the
  306.           specular  component.   Some typical material properties
  307.           are chalk (0.0, 1.0, 0.0,  0.0),  plastic  (0.0,  0.75,
  308.           0.25,  20.0),  aluminium (0.0, 0.25, 0.75, 6.0).  Note:
  309.           note for the refractive index to have  any  effect  the
  310.           object   must  have  some  transparency  specified.  An
  311.           refractive index of 1.5 is a good place to start.
  312.  
  313.      shadows on|off
  314.           Specifies whether or not the object is to cast  a  sha-
  315.           dow. The default is on.
  316.  
  317.      tile
  318.           specifies a tiling pattern for an object.
  319.  
  320.                     e.g. tile filename size 0.25, 0.25
  321.  
  322.           Reads the tiling pattern from filename  (another  image
  323.           file  produced by a program using the vort library) and
  324.           tiles the object as though the  pattern  represents  an
  325.           image  1/4  of the surface area of the object. If tiles
  326.           are used through the texture keyword they may  also  be
  327.           rotated,  etc,  as is sensible. Tiles can be applied to
  328.           anything but boxes, geometries, csgs and algebraics.
  329.  
  330.      texture {
  331.                     texture body
  332.                }
  333.           specifies a texture for an object.  The current texture
  334.           types are:
  335.  
  336.      marble
  337.           - a marble type  texture,  basically  this  texture  is
  338.           formed  by  modeling  heterogenous  layers of differing
  339.           materials. Each layer  is  then  perturbed  (in  the  X
  340.           direction)  by a "turbulent" function to give a streaky
  341.           look.
  342.  
  343.      granite
  344.           - a granite  looking  texture,  this  texture  randomly
  345.           mixes a "blendcolor" with the base color of the object.
  346.  
  347.      wood - a wood grain looking texture, this texture  simulates
  348.           wood  grain by modeling a tree trunk with randomly per-
  349.           turbed concentric cylinders.
  350.  
  351.     wood2
  352.           - another wood grain texture, This is similar to "wood"
  353.           but  the  cylinder  perturbation  is carried out over a
  354.           number of octaves  to  give  1/f  perturbation  to  the
  355.           rings.
  356.  
  357.      spotted
  358.           - makes funny 'spots' on the object by randomly  blend-
  359.           ing the colour white with the basecolour
  360.  
  361.      fuzzy
  362.           - makes things look fuzzy by  randomly  perturbing  the
  363.           objects normal vector.
  364.  
  365.      stucco
  366.           - produces a plasted effect by perturbing  the  objects
  367.           normal vector
  368.  
  369.      ripples
  370.           - makes what looks likes water ripples.  This  is  done
  371.           by  summing the contibutions of a set of randomly posi-
  372.           tioned wave sources and perturbing the  objects  normal
  373.           verctor.
  374.  
  375.      waves
  376.           - makes non-random wave patterns.  The user may specify
  377.           the position and amplitude etc of a set of wave sources
  378.           whose contributions are summed to perturb  the  objects
  379.           normal vector
  380.  
  381.      bumpy
  382.           - makes what looks like bumps  by  randomly  perturbing
  383.           the objects normal vector.
  384.  
  385.      colourblend
  386.           - does a linear colour blend along the y axis.
  387.  
  388.      tile - tiles a preexisting picture onto an object.
  389.  
  390.      The following options can be specified with most of the textures
  391.  
  392.      blend expr
  393.                Specify how much of the current texture  to  blend
  394.           with the object      colour. For example, we might wish
  395.           to blend two tile patterns      together  so  we  could
  396.           use:
  397.  
  398.                texture tile {
  399.                     vortfile tile1.pix
  400.                     blend 0.5      /* Blend %50 of tile1 to object */
  401.                }
  402.                texture tile {
  403.                     vortfile tile2.pix
  404.                     blend 0.75          /* Blend %75 of tile2 to object */
  405.                }                   /* plus tile1 */
  406.  
  407.      blendcolor red, green, blue
  408.                Specify a colour to blend with the base colour  of
  409.           the  object.        For  example,  the vein colour in a
  410.           marble texture or the ring      colour in a wood grain.
  411.  
  412.  
  413.      colormap filename
  414.                Rather than use the blendcolor (see above) colours
  415.           may  be      specified in a colour map file. Instead of
  416.           mixing with the      base colour, an  index  into  this
  417.           colour  map  is  derived  from      the texture and the
  418.           resulting colour from the map is used.
  419.  
  420.                The format of the file is:
  421.                     number_of_entries        - integer
  422.                     r1, g1, b1               - floats (between 0 and 1)
  423.                     .   .   .
  424.                     .   .   .
  425.                     rn, gn, bn
  426.  
  427.  
  428.      colourmap {
  429.                     r1, g1, b1,
  430.                     r2, g2, c2,
  431.                     .   .   . ,
  432.                     .   .   . ,
  433.  
  434.                     rn, gn, bn
  435.                }
  436.  
  437.                Instead of specifying a colourmap file  as  above,
  438.           the  colourmap       entries may be directly specified.
  439.           (Remember the commas at the      end  of  all  but  the
  440.           last line).
  441.  
  442.  
  443.      turbulence expr
  444.  
  445.           Some textures have a turbulent  or  a  noisy  character
  446.      about       them.  This  parameter  attempts to control this
  447.      aspect in the      texture.
  448.  
  449.  
  450.      squeeze expr
  451.                With the marble and wood textures, the  veins  for
  452.           rings may      be made thinner (spacing stays the same)
  453.           by increasing this      parameter.  Usually  a  maximum
  454.           squeeze  of  no  more than 3 or 4      is recomended as
  455.           the resultant change is  very  small  above       these
  456.           values.
  457.  
  458.  
  459.      scalefactor expr
  460.                Some textures require a  single  scalefactor  (eg.
  461.           fuzzy, spotted, ripples)      that controls the overall
  462.           character of the texture. For  example,       with  the
  463.           fuzzy texture the scale factor controls 'overall fuzzi-
  464.           ness'      of the texture. For the spotted  texture  it
  465.           controls  the  mixing       of the white noise with the
  466.           objects basecolour.
  467.  
  468.  
  469.      scalefactors expr, expr, expr
  470.                Some textures require more than  one  scalefactor.
  471.           (eg. bumpy - where each component of the normal pertur-
  472.           bation may be controlled, and  colourblend,  where  the
  473.           first  value  is  a start point along y, the second the
  474.           distance you want to blend over, and the third the tur-
  475.           bulance)       In  fact,  for  the textures that do not
  476.           explicitly require a      scalefactors field, the first
  477.           value  equates  to a "size" scale      for the texture,
  478.           the second to the turbulence, and the third      to the
  479.           squeeze.  This gives a shorthand way of specify in some
  480.                parameters and is backwardly compatible with older
  481.           versions      of art.
  482.  
  483.      source {
  484.                     wave source specification
  485.                }
  486.                The waves texture should have  one  or  more  wave
  487.           sources defined.       The location of each wave source
  488.           is      given      by      the       center(x,       y,
  489.           z)keyword.Otherparametersfora
  490.  
  491.      wavelength expr
  492.  
  493.      phase expr
  494.  
  495.      damping expr
  496.  
  497.      amplitude expr
  498.  
  499.           all of which have their traditional meanings.
  500.  
  501.      Textures are applied in the object's canonical space and are
  502.      automatically  scaled  by the object's size unless specified
  503.      outside the scope of the object. Tiles appearing in textures
  504.      are  applied  in  the  object's  canonical space.  Canonical
  505.      spaces for objects are as follows:
  506.      boxes, cylinders, cones
  507.           - bottom z equals zero, top z equals one.
  508.  
  509.      spheres, ellipsoids, superquadrics
  510.           - unit radius centered at the origin.
  511.  
  512.      rings and torii
  513.           - unit radius, lying in the xy-plane, facing z.
  514.  
  515.      polygons
  516.           - lying in the positive xy-plane, one corner at (0,  0,
  517.           0), scaled to a unit square.
  518.  
  519.      Additionally transformations such as  rotation,  etc...  can
  520.      also  be used in textures. These transformations are applied
  521.      after the viewing and, if the  texture  is  defined  in  the
  522.      object's scope, the object transformation.  For example:
  523.  
  524.                texture tile {
  525.                     size 0.25, 0.25
  526.                     vortfile tile.pix
  527.                     rotate(45, y)
  528.                }
  529.  
  530.      will tile an object with the tile pattern rotated in  object
  531.      space by 45 degrees around y.  Examples
  532.  
  533.                texture marble {
  534.                     blendcolour 0.4, 0.1, 0.1
  535.                     turbulence 30
  536.                     squeeze 2
  537.                     rotate(90.0, x)
  538.                     range 6
  539.                }
  540.  
  541.                texture waves {
  542.                     source {
  543.                          center(0, 0, 0)
  544.                          amplitude 1
  545.                          wavelength 2
  546.                     }
  547.                     source {
  548.                          center(1, 0, 0)
  549.                          amplitude 0.5
  550.                          wavelength 2.5
  551.                          damping 0.2
  552.                     }
  553.                }
  554.  
  555.                texture fuzz scalefactor 0.2
  556.  
  557.                texture wood {
  558.                     rotate(90, y)
  559.                     turbulence 2
  560.                     squeeze 2
  561.                     blendcolor 0.2, 0.2, 0.2
  562.                }
  563.  
  564.  
  565.                texture marble {
  566.                     rotate(60, z)
  567.                     translate(0.2, 0.2, 0.2)
  568.                     turbulence 3
  569.                     colourmap {
  570.                          1.0, 1.0, 1.0,
  571.                          1.0, 1.0, 1.0,
  572.                          1.0, 1.0, 1.0,
  573.                          1.0, 1.0, 1.0,
  574.                          0.0, 0.0, 0.0,
  575.                          0.0, 0.0, 0.0,
  576.                          1.0, 1.0, 1.0,
  577.                          1.0, 1.0, 1.0,
  578.                          1.0, 1.0, 1.0,
  579.                          1.0, 1.0, 1.0,
  580.                          1.0, 1.0, 1.0
  581.                     }
  582.  
  583.                texture tile vortfile lenna.pix
  584.  
  585.                texture tile {
  586.                     rotate (90, z)
  587.                     vortfile lenna.pix
  588.                     blend 0.5
  589.                }
  590.  
  591.      The tile texture needs to be given a  size  if  the  default
  592.      (1.0,  1.0)  is  not  wanted.  The  pixel file being used is
  593.      specified using the vortfile keyword.  Textures may also  be
  594.      used  to  modulate  different  surface attributes other than
  595.      colour. For example, a texture may be used to  modulate  the
  596.      transparency  of  an  object. This is done by specifying the
  597.      attribute  to  modulate  then  a  texture  specification  as
  598.      described above. For example:
  599.  
  600.           transparency texture marble {
  601.                blendcolor 1, 1, 1
  602.                turbulence 2
  603.           }
  604.  
  605.      would modulate the transparency of an object.
  606.  
  607.  
  608.           polygon {
  609.                material 1, 0.5, 0.5, 10
  610.                vertex(-1, -1, 0)
  611.                vertex(-1, 1, 0)
  612.                vertex(1, 1, 0)
  613.                vertex(1, -1, 0)
  614.                transparency texture tile {
  615.                     vortfile lenna.pix
  616.                }
  617.           }
  618.  
  619.      would produce a polygon with a transparent  image  on  it  -
  620.      similar  to  a  slide.  Attributes that may be modified with
  621.      textures are:
  622.  
  623.  
  624.      transparency - the colour returned from the texture function
  625.           is used to set the transparency values of the object.
  626.  
  627.      ambient - the colour returned from the texture  function  is
  628.           used to set the ambient values of the object.
  629.  
  630.      reflectance - the colour returned from the texture  function
  631.           is used to set the reflectance values of the object.
  632.  
  633.      ri - the grayscale equivalent of the  colour  returned  from
  634.           the  texture  function is added to the refractive index
  635.           of the object.
  636.  
  637.  
  638.  
  639.  
  640.      colour
  641.           specifies the object's colour.
  642.  
  643.                     e.g. colour 1.0, 1.0, 1.0
  644.  
  645.           makes an object white. The word color can also be used.
  646.  
  647.      reflectance
  648.           sets the amount of reflectance for an object.
  649.  
  650.                     e.g. reflectance 0.75
  651.  
  652.           indicates that 75% of the light coming from  an  object
  653.           is reflected from somewhere else.
  654.  
  655.      transparency
  656.           set the transparency of an object.
  657.  
  658.                     e.g. transparency 0.75
  659.  
  660.           indicates that 75% of the light  behind  an  object  is
  661.           transmitted  through  it. Transparent objects will look
  662.           washed out if the diffuse component is too high and the
  663.           specular  component too low. For example a glass object
  664.           might have the following properties:
  665.  
  666.                     meterial 1.5, 0.1, 0.9, 100
  667.                     transparency 0.9
  668.                     reflectance 0.1
  669.  
  670.  
  671.      absorption
  672.           set the absorption factor for an object.
  673.  
  674.                     e.g. absorption 0.35
  675.  
  676.           indicates that 35% of the light coming from  an  object
  677.           is  absorbed  per  unit of length in world units. Tran-
  678.           sparency must be used also for this to be effective.
  679.  
  680.   Defining Objects.
  681.      sphere
  682.           defines a sphere. The radius and  the  centre  must  be
  683.           given.
  684.  
  685.                     e.g. sphere {
  686.                               colour 1.0, 0.0, 0.0
  687.                               material 0.0, 0.25, 0.75, 6.0
  688.                               reflectance 0.75
  689.                               center (-2.0, -0.5, -6.0)
  690.                               radius    1.1
  691.                          }
  692.  
  693.  
  694.      ellipsoid
  695.           defines an axis-aligned ellipsoid. The  center  of  the
  696.           ellipsoid and the radii for each axis need to be speci-
  697.           fied. The usual set of transformations may  be  applied
  698.           to  an  ellipsoid  when  a  non  axis-aligned object is
  699.           required.
  700.  
  701.                     e.g. ellipsoid {
  702.                               colour 0.7, 0.5, 0.5
  703.                               material 0.0, 1.0, 0.0, 0.0
  704.                               rotate(45.0, x)
  705.                               center (0.0, 0.0, 0.0)
  706.                               radii 1.5, 0.5, 6.0
  707.                          }
  708.  
  709.  
  710.      box
  711.           defines an  axis-aligned  box.  It  requires  the  top-
  712.           front-right  and  the  bottom-back-left  corners  to be
  713.           specified. The usual  set  of  transformations  may  be
  714.           applied  to  a  box  when  a non axis-aligned object is
  715.           required.
  716.  
  717.                     e.g. box {
  718.                               colour 0.7, 0.5, 0.5
  719.                               material 0.0, 1.0, 0.0, 0.0
  720.                               vertex (2.5, 2.5, -5.0)
  721.                               vertex (1.5, 0.5, -6.0)
  722.                          }
  723.  
  724.  
  725.      cylinder
  726.           defines a cylinder. The centers of the  two  faces  are
  727.           needed  together  with the radius. An elliptic cylinder
  728.           can be defined by using radii  (e.g.  radii  2.0,  1.0)
  729.           instead of radius.
  730.  
  731.                     e.g. cylinder {
  732.                               colour 1.0, 0.0, 0.0
  733.                               material 0.0, 0.75, 0.25, 6.0
  734.                               center (0.0, 4.0, -6.0)
  735.                               center (0.0, -3.5, -6.0)
  736.                               radius    2.5
  737.                          }
  738.  
  739.  
  740.      cone
  741.           defines a cone. The tip of the cone plus the center  of
  742.           its  face and its radius is needed. Elliptic cones will
  743.           be generated if radii is used. If  another  center  and
  744.           rdaius  are  provided instead of the vertex a truncated
  745.           cone is generated instead.
  746.  
  747.                     e.g. cone {
  748.                               colour 1.0, 0.0, 0.0
  749.                               material 0.0, 1.0, 0.0, 0.0
  750.                               vertex (0.0, 20.0, 0.0)
  751.                               center (0.0, 0.0, 0.0)
  752.                               radius    5.5
  753.                          }
  754.  
  755.  
  756.      torus
  757.           defines a right circular torus. The definition requires
  758.           the  center  of  the torus and values for the radius of
  759.           the torus and the radius of its pipe.  Unless  a  rota-
  760.           tion,  via  rotate,  is  specified all torii have their
  761.           major axis in a plane parallel to the (x, y) plane.
  762.  
  763.                     e.g. torus {
  764.                               colour 1.0, 0.0, 0.0
  765.                               material 0.0, 0.95, 0.00, 0.0
  766.                               center (0.0, 0.0, 0.0)
  767.                               radius 3.0
  768.                               radius 2.0
  769.                          }
  770.  
  771.  
  772.       polygon
  773.           describes a polygon by specifying the vertices  of  the
  774.           polygon.  If a tile pattern is defined the first vertex
  775.           specified is used to map  the  tile  pattern  onto  the
  776.           polygon.
  777.  
  778.                     e.g. polygon {
  779.                               colour 1.0, 0.0, 0.0
  780.                               material 0.0, 1.0, 0.0, 0.0
  781.                               tile rb.pix size 0.5, 0.5
  782.                               vertex (-2.0, -0.7, -2.0)
  783.                               vertex (2.0, -0.7, -2.0)
  784.                               vertex (2.0, -0.7, 2.0)
  785.                               vertex (-2.0, -0.7, 2.0)
  786.                          }
  787.  
  788.           describes a four sided polygon. In the case  of  3  and
  789.           most  4  sided  polygons additional surface normals and
  790.           colours can be specified that will be interpolated from
  791.           the  polygons  vertices.  The  following  example shows
  792.           where both have been added, the second set  of  numbers
  793.           in  parentheses is the normal at that vertex, the third
  794.           set of numbers is the colour at that vertex.  The  nor-
  795.           mals  and  colours  may  be specified in any order, and
  796.           don't need to  be  specified  together.  Note:  if  the
  797.           polygon is 4 sided a base colour for it must be defined
  798.           as the interpolation works by dividing the  polygon  up
  799.           into  triangles,  generally  this base colour should be
  800.           the average of the normal colours, although interesting
  801.           results can be obtained when it isn't.
  802.  
  803.                 e.g.    polygon {
  804.                          colour 1.0, 0.0, 0.0
  805.                          material 0.0, 1.0, 0.0, 0.0
  806.                          tile rb.pix size 0.5, 0.5
  807.                          vertex (-2.0, -0.7, -2.0), (0, 1, 0), 1.0, 0.0, 0.0
  808.                          vertex (2.0, -0.7, -2.0), (0, 1, 1), 0.0, 1.0, 0.0
  809.                          vertex (2.0, -0.7, 2.0), (0, 1, -1), 0.0, 0.0, 1.0
  810.                     }
  811.  
  812.  
  813.       disk
  814.           describes a disk.
  815.  
  816.                     e.g. disk {
  817.                               colour 1.0, 0.0, 0.0
  818.                               material 0.0, 1.0, 0.0, 0.0
  819.                               center (0.0, 0.0, 0.0)
  820.                               radius 1.0
  821.                          }
  822.  
  823.           describes a disk of unit radius at the origin,  in  the
  824.           (x,  y)  plane. If an elliptical disk is required radii
  825.           can be used instead of radius. Disks can be transformed
  826.           as required.
  827.  
  828.       ring
  829.           describes a ring.
  830.  
  831.                     e.g  ring {
  832.                               colour 1.0, 0.0, 0.0
  833.                               material 0.0, 1.0, 0.0, 0.0
  834.                               center (0.0, 0.0, 0.0)
  835.                               radius 1.0
  836.                               radius 0.5
  837.                          }
  838.  
  839.           describes a ring of unit radius at the origin,  in  the
  840.           (x,  y)  plane,  with a hole in it radius of 0.5. If an
  841.           elliptical ring is required radii can be  used  instead
  842.           of radius. Rings can be transformed as required.
  843.  
  844.      geometry
  845.           describes a multi-faceted object. If the  object  is  a
  846.           polyhedron  it  can  be  used in csg modeling. Geometry
  847.           objects can be a set of polygons defined in a  geometry
  848.           file,  a strip of triangles or a heightfield.  They may
  849.           be phong shaded and backfaced if required.  It is noted
  850.           that  some  things  are not designed with backfacing in
  851.           mind.
  852.  
  853.                     e.g. geometry {
  854.                               colour 1.0, 0.0, 0.0
  855.                               material 0.0, 0.25, 0.75, 6.0
  856.                               phongshading on
  857.                               backfacing on
  858.                               offfile goblet.geo
  859.                          }
  860.  
  861.           If phong shading is not specified the geometry model is
  862.           flat  shaded.  Currently  only  offfiles  (files in the
  863.           "object file format") and strips are supported  by  the
  864.           geometry  option.  The offiles describing the colour of
  865.           individual polygons, the  vertex  normals,  the  vertex
  866.           colours,  and  the polygon normals may also be included
  867.           in the geometry, their keywords are  colourfile,  vnor-
  868.           malfile, vcolourfile, and normalfile respectively.
  869.           The triangle strips are introduced using the strip key-
  870.           word.  In its most basic form a strip which defines two
  871.           triangles would look as follows:
  872.  
  873.                     e.g. geometry {
  874.                               strip {
  875.                                   (-9.523, 10.625, -7.842)
  876.                                   (-8.662,  9.543, -9.554)
  877.                                   (-9.435, 10.241, -7.556)
  878.                                   (-8.574,  9.159, -9.267)
  879.                               }
  880.                          }
  881.  
  882.           Each line defines a vertex. The first triangle is  com-
  883.           posed  of  the first three vertices, and the second the
  884.           last three. The surface normals for each of the  trian-
  885.           gles  are  reversed  for every second one (i.e they are
  886.           calculated 1, 2, 3, then 4, 3, 2, then 3, 4, 5....), so
  887.           that strips can be backfaced sensibly.
  888.  
  889.           It is also possible to associate vertex colours with  a
  890.           strip:
  891.  
  892.                     e.g. geometry {
  893.                               strip {
  894.                                   (-9.523, 10.625, -7.842), 1.0, 0.0, 0.0
  895.                                   (-8.662,  9.543, -9.554), 0.0, 1.0, 0.0
  896.                                   (-9.435, 10.241, -7.556), 1.0, 0.0, 0.0
  897.                                   (-8.574,  9.159, -9.267), 0.0, 0.0, 1.0
  898.                               }
  899.                          }
  900.  
  901.           In this case each line defines a vertex,  vertex-colour
  902.           pair.
  903.  
  904.           Two formats of heightfields are supported, the first is
  905.           a  binary  file  with  an  int  at the front giving the
  906.           dimension of the grid followed by a list  of  z  values
  907.           (floats),  the  second  is  a  binary  file of z values
  908.           (floats) that begins with one line of text.
  909.  
  910.                     e.g. HEIGHTFIELD xdim ydim
  911.                          <floats>.....
  912.  
  913.           where xdim, and ydim are the dimensions (eg. 640  480).
  914.           The height field described in the file is assumed to be
  915.           in the range 0 to 1 in it's longest dimension.
  916.  
  917.                     e.g. geometry {
  918.                               colour 1.0, 0.0, 0.0
  919.                               material 0.0, 0.25, 0.75, 6.0
  920.                               phongshading on
  921.                               heightfield land.hf
  922.                          }
  923.  
  924.           Heightfields  may  also  be  tiled  with  an  image  or
  925.           coloured  using  a colorfield. A colorfield is a binary
  926.           file of rgb values (all floats) that  begins  with  one
  927.           line of text.
  928.  
  929.                     e.g. COLORFIELD xdim ydim
  930.                          <floats>.....
  931.  
  932.           where xdim, and ydim are the dimensions (eg. 640  480).
  933.           It  is  assumed that the colorfield has the same dimen-
  934.           sions as it's corresponding heightfield.
  935.  
  936.      superquadric
  937.           is used to define a superquadric surface. Superquadrics
  938.           are basically boxes with curved edges, with a superqua-
  939.           dric of order 1 looking like a diamond with  8  facets.
  940.           They are defined as a bounding box and an order.
  941.  
  942.                     e.g. superquadric {
  943.                               colour 1.0, 0.0, 0.0
  944.                               material 0.0, 0.95, 0.0, 0.0
  945.                               vertex (3.0, 9.0, 3.0)
  946.                               vertex (-3.0, 3.0, -3.0)
  947.                               order 1.0
  948.                          }
  949.  
  950.  
  951.      algebraic
  952.           is used to describe an algebraic surface. Currently the
  953.           maximum  order  for  a  surface  is  12  (MAX_ORDER  in
  954.           poly.h). The equation for the surface is in TeX format.
  955.  
  956.                     e.g. algebraic {
  957.                               colour 1.0, 0.0, 0.0
  958.                               material 0.0, 0.95, 0.00, 0.0
  959.                               equation $$ x^{2} + y^{2} + z^{2} - 1 = 0 $$
  960.                          }
  961.  
  962.           describes a sphere of unit radius.
  963.  
  964.           The area of the surface being looked  at  can  be  res-
  965.           tricted  by using a clip volume (as well as csg, defin-
  966.           ing a clipping volume is faster).  Clip volumes may  be
  967.           spheres, cylinders, or boxes. The following is an exam-
  968.           ple of the use of a clip volume.
  969.  
  970.                     algebraic {
  971.                          colour 1.0, 0.0, 0.0
  972.                          material 0.0, 0.95, 0.00, 0.0
  973.                          equation $$
  974.                               x^{4} + y^{4} + z^{4} + 1
  975.                               - x^{2} - y^{2} - z^{2}
  976.                               - y^{2}z^{2} - z^{2}x^{2} - x^{2}y^{2}
  977.                               = 0
  978.                          $$
  979.                          clipvolume box {
  980.                               vertex (3.0, 3.0, 3.0)
  981.                               vertex (-3.0, -3.0, -3.0)
  982.                          }
  983.                     }
  984.  
  985.  
  986.      composite
  987.           is used to specify a composite object.  This  construct
  988.           is  still  a bit restricted but is useful if a bunch of
  989.           related objects need to be transformed in the same way.
  990.           Composites cannot be used in csg modeling.
  991.  
  992.                     e.g. composite {
  993.                               rotate(45.0, y)
  994.                               colour 1.0, 0.0, 0.0
  995.                               material 0.0, 0.95, 0.00, 0.0
  996.  
  997.                               sphere {
  998.                                    center(0.0, 0.0, 0.0)
  999.                                    radius 1.0
  1000.                               }
  1001.                               sphere {
  1002.                                    center(0.0, 0.0, 2.0)
  1003.                                    radius 0.5
  1004.                               }
  1005.                          }
  1006.  
  1007.  
  1008.      csg
  1009.           is used to specify  a  CSG  model.  Constructive  solid
  1010.           geometry  operations may be applied to any of the above
  1011.           except where stated otherwise. The syntax for  the  CSG
  1012.           operations  are: + for union, - for subtract, and * for
  1013.           intersect. CSG requires the naming of the objects  mak-
  1014.           ing  up the model. Other CSG objects can be included in
  1015.           the model definition.
  1016.  
  1017.                     e.g. csg {
  1018.                               sphere s1 {
  1019.                                    colour 0.8, 0.1, 0.0
  1020.                                    material 0.0, 0.95, 0.05, 6.0
  1021.                                    center (1.7, 3.1, -4.5)
  1022.                                    radius    2.0
  1023.                               }
  1024.                               sphere s2 {
  1025.                                    colour 0.8, 0.1, 0.0
  1026.                                    material 0.0, 0.95, 0.05, 6.0
  1027.                                    center (4.7, -1.7, -4.5)
  1028.                                    radius    2.0
  1029.                               }
  1030.                               box b1 {
  1031.                                    colour 1.0, 0.0, 0.0
  1032.                                    material 0.0, 1.0, 0.0, 0.0
  1033.                                    vertex (4.5, 2.5, -5.0)
  1034.                                    vertex (1.5, -1.5, -8.0)
  1035.                               }
  1036.  
  1037.                               (b1 - s1) - s2
  1038.                          }
  1039.  
  1040.           Note that it is wise to allow some room  for  numerical
  1041.           error when doing a csg subtract. The following will not
  1042.           always work:
  1043.  
  1044.                csg {
  1045.                     box b1 {
  1046.                          colour 1.0, 0.0, 0.0
  1047.                          material 0.0, 1.0, 0.0, 0.0
  1048.                          vertex (4.5, 2.5, -5.0)
  1049.                          vertex (1.5, -1.5, -8.0)
  1050.                     }
  1051.                     box b2 {
  1052.                          colour 1.0, 0.0, 0.0
  1053.                          material 0.0, 1.0, 0.0, 0.0
  1054.                          vertex (4.5, 2.0, -4.0)
  1055.                          vertex (1.5, -1.0, -7.0)
  1056.                     }
  1057.  
  1058.                     (b1 - b2)
  1059.                }
  1060.  
  1061.           whereas:
  1062.  
  1063.                csg {
  1064.                     box b1 {
  1065.                          colour 1.0, 0.0, 0.0
  1066.                          material 0.0, 1.0, 0.0, 0.0
  1067.                          vertex (4.5, 2.5, -5.0)
  1068.                          vertex (1.5, -1.5, -8.0)
  1069.                     }
  1070.                     box b2 {
  1071.                          colour 1.0, 0.0, 0.0
  1072.                          material 0.0, 1.0, 0.0, 0.0
  1073.                          vertex (5.5, 2.0, -4.0)
  1074.                          vertex (0.5, -1.0, -7.0)
  1075.                     }
  1076.  
  1077.                     (b1 - b2)
  1078.                }
  1079.  
  1080.           will, (hint: look at the definition for b2).
  1081.  
  1082.   Repeating Objects in a scene.
  1083.      If an object is created with a name (as  in  csg)  then  the
  1084.      object will not appear in the scene unless the name of it is
  1085.      used elsewhere in the file as an object type.  This  can  be
  1086.      useful  if  you  have  a  composite object which you wish to
  1087.      define several occurances of, for example:
  1088.           composite com {
  1089.                colour 1.0, 1.0, 1.0
  1090.                .
  1091.                .
  1092.                .
  1093.  
  1094.           }
  1095.  
  1096.           com {
  1097.                translate(-10, 0, 0)
  1098.           }
  1099.  
  1100.           com {
  1101.                translate(10, 0, 0)
  1102.           }
  1103.      puts two 'com' objects in the scene which are tranlated ver-
  1104.      sions of the original ones.
  1105.  
  1106.      Alternatively the  repeat  statement can be used to  provide
  1107.      more than one occurance of an object.
  1108.  
  1109.           repeat 4 {
  1110.                translate(5, 0, 0)
  1111.                com
  1112.           }
  1113.  
  1114.      creates four occurances of the  object  com  with  each  one
  1115.      occuring a further 5 units along in positive x.
  1116.  
  1117.   Transformations.
  1118.      Three transformations may be  applied,  rotate,  scale,  and
  1119.      translate,  as well as a more general transformation matrix.
  1120.      As with object attributes, matrices live in  a  stack  so  a
  1121.      transformation  applied  outside the scope of an object will
  1122.      apply to that object, in  addition  to  any  transformations
  1123.      that may be specified in the object itself.
  1124.  
  1125.      translate
  1126.           Translation can be applied to any primitive.
  1127.  
  1128.                     e.g. translate(1.0, 0.0, 0.0)
  1129.           shifts the object in x by 1.0.
  1130.  
  1131.      rotate
  1132.           Rotation can be applied to any primitive.
  1133.  
  1134.                     e.g. rotate(90.0, x)
  1135.  
  1136.           rotates the object 90 degrees around x.
  1137.  
  1138.      scale
  1139.           Scaling may be done on any primitive.
  1140.  
  1141.                     e.g. scale(2.0, 2.0, 2.0)
  1142.  
  1143.           scales the object by 2.
  1144.  
  1145.      transform
  1146.           The transform keyword can be used to introduce a 4 x  3
  1147.           transformation matrix.
  1148.  
  1149.                     e.g. transform {
  1150.                          R11, R12, R13,
  1151.                          R21, R22, R23,
  1152.                          R31, R32, R33,
  1153.                          TX, TY, TZ
  1154.                          }
  1155.  
  1156.           The R values represent rotations (possibly  with  an  a
  1157.           scaling  vector  applied)  and  the  T values represent
  1158.           translation. Strictly speaking this is treated as a 4 x
  1159.           4 but the last column is always assumed to be (0, 0, 0,
  1160.           1).
  1161.  
  1162. BUGS
  1163.      While the twentyfive bit mode does set the twenty fifth  bit
  1164.      it doesn't seem to change the picture quality.
  1165.  
  1166.      On the IBM PC, you can't have more than  5450  vertices  and
  1167.      1300 polygons in a geometry file.
  1168.  
  1169.  
  1170. SEE ALSO
  1171.      disp(1), vortinfo(1), targ2vort(1),  vort2ps(1),  median(1),
  1172.      mulmcut(1),   greyscale(1),   gamma(1),  movie(1),  dart(1),
  1173.      nart(1), vort(3).
  1174.  
  1175.  
  1176.